package com.cscec.omega.service;

import com.cscec.omega.dao.ProjectDao;
import com.cscec.omega.entity.ProjectEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectService {

    private static Logger logger = LoggerFactory.getLogger(ProjectService.class);

    @Autowired
    private ProjectDao dao;

    public ProjectEntity save(ProjectEntity projectEntity){
        projectEntity = dao.save(projectEntity);
        return projectEntity;
    }

    public List<ProjectEntity> findAll(ProjectEntity projectEntity){
        List<ProjectEntity> list = dao.findAll();
        return list;
    }

    public ProjectEntity getProject(Integer id){
        ProjectEntity result = dao.getOne(id);
        return result;
    }

    public void delete(Integer id){
        dao.deleteById(id);
    }
}
